package ja.lingo.engine.beans;

import ja.lingo.engine.beans.marks.IMark;
import ja.lingo.engine.beans.marks.MarkImpl;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Manusovich Alexander
 * @version $Id:$
 */
public class WordImpl implements Word {
    private Long id;
    private String value;
    private String translated;
    private List<IMark> marks;

    public WordImpl(Long id) {
        this.id = id;
        init();
    }

    public WordImpl(Long id, String value, String translated) {
        this.id = id;
        this.value = value;
        this.translated = translated;
        init();
    }

    public WordImpl(String value, String translated) {
        this.id = (long) value.hashCode();
        this.value = value;
        this.translated = translated;
        init();
    }

    private void init() {
        marks = new ArrayList<IMark>();
        marks.add(new MarkImpl(IMark.MARK_A));
        marks.add(new MarkImpl(IMark.MARK_B));
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTranslated() {
        return translated;
    }

    public void setTranslated(String translated) {
        this.translated = translated;
    }

    public List<IMark> getMarks() {
        return marks;
    }

    public void setMarks(List marks) {
        this.marks = marks;
    }

    public String toString() {
        return "WordImpl: value: " + value + ", marks: " + marks;
    }
}
